#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'bam bed'
exit 1
}

while getopts  ":p:f:i:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
        i) bed=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

. $var

bam=$1
bed=$2

# HaplotypeCaller # its use is not recommended for somatic (cancer) variant discovery. For that purpose, use MuTect2 instead.

echo; echo HaplotypeCaller
$java_run/gatk33 \
    -R $ref_genome \
    -T HaplotypeCaller \
    -I $bam \
    --emitRefConfidence GVCF \
    -L $bed \
    -o $out_prefix.g.vcf \
    -variant_index_type LINEAR -variant_index_parameter 128000 # version older than 3.4

. $cmd_done

